package com.bbz.spring.config;

import com.bbz.spring.Controller.MainController;
import com.bbz.spring.Service.MainService;
import com.bbz.spring.bean.People;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Controller;

@Configuration
@ComponentScan(value = "com.bbz.spring", excludeFilters = {
        @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = Controller.class),
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,classes = MainService.class),
        @ComponentScan.Filter(type = FilterType.CUSTOM,classes = MyTypeFilter.class)
}/*, includeFilters = {
        @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = Controller.class)
}, useDefaultFilters = false*/)
//ComponentScan 扫描指定的类到IOC容器中
//excludeFilters 过滤掉用Controller注解修饰的类
//includeFilters 仅把includeFilters指定的类加载到容器中
//FilterType.ANNOTATION,按照注解方式
//FilterType.ASSIGNABLE_TYPE 按照指定的类型
//FilterType.ASPECTJ ,使用ASPECTJ 表达式
//FilterType.REGEX,使用正则表达式
//FilterType.CUSTOM ,使用自定义规则，自定义规则需要实现FilterType接口
public class MainConfig {
    @Bean
    public People people() {
        return new People("binbin", 11);
    }

}
